cmake_minimum_required(VERSION 3.10)

project(high-concurrency)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# 设置Boost最小版本并指定system组件
find_package(Boost 1.74.0 REQUIRED COMPONENTS system)

# 平台特定配置
if(WIN32)
    add_definitions(-D_WIN32_WINNT=0x0601)  # Windows 最低版本
    list(APPEND LINK_LIBS ws2_32)# 链接 Winsock
else()
    find_package(Threads REQUIRED)
    list(APPEND LINK_LIBS Threads::Threads)
endif()

# 添加可执行文件
add_executable(server main.cpp)
target_link_libraries(server PRIVATE 
    Boost::headers
    Boost::system
    ${LINK_LIBS}
)

# 将所有可执行文件统一输出到项目根目录的 bin/ 文件夹
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# 设置 Boost 包含路径
target_include_directories(server PRIVATE ${Boost_INCLUDE_DIRS})

message(STATUS "Boost found: ${Boost_FOUND}")
message(STATUS "Boost includes: ${Boost_INCLUDE_DIRS}")


# set(CMAKE_BUILD_TYPE Release)
# set(CMAKE_EXE_LINKER_FLAGS "-static")